<?php
require(dirname(__FILE__) . '/includes/init.php');
if(empty($_REQUEST['sn'])){
	header("Location: customerservice.php\n");
}else{
	$sql = "SELECT * FROM ".$ecs->table('orders')." WHERE order_id='".$_REQUEST['sn']."'";
	$order = $db->getRow($sql);
}
if ($_REQUEST['act'] == 'do')
{
	$order_id = intval($_REQUEST['order_id']);
	if(empty($order_id)){
		header("Location: customerservice.php\n");
	}
	$sql = "SELECT order_id FROM ".$ecs->table('orders')." WHERE order_id='".$order_id."'";
	$order_id = $db->getOne($sql);
	if(empty($order_id)){
		header("Location: customerservice.php\n");
	}else{
		$status = $_REQUEST['status'];
        $action_name = $_REQUEST['action_name'];
		$do_name = $_REQUEST['do_name'];
		$content = $_REQUEST['content'];
		$sql = "INSERT INTO " .$ecs->table('orders_action'). "(contents,order_id,action_name,status,action_time,do_name)".
                "VALUES ('".$content."','".$order_id."', '".$action_name."','".$status."','".gmtime()."','".$do_name."')";
        $db->query($sql);
		if($db->insert_id()){
			$sql = "UPDATE " .$ecs->table('enrols'). " set ques_status='".$status."',deal_cat='".$action_name."' where order_id='".$order_id."'";
        $db->query($sql);
		}
        header("Location: customerservice.php\n");
    }
}
?>
<!-- $Id: goods_info.htm 17126 2010-04-23 10:30:26Z liuhui $ -->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>管理中心 - 解决记录 </title>
<meta name="robots" content="noindex, nofollow">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link href="styles/general.css" rel="stylesheet" type="text/css" />
<link href="styles/main.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="js/jquery.min.js"></script>
<script type="text/javascript" src="js/common.js"></script>
</head>
<body>
 
<h1>
<span class="action-span"><a href="customerservice.php">售后列表</a></span>
<span class="action-span1"><a href="index.php?act=main">管理中心</a> </span><span id="search_id" class="action-span1"> - 解决记录 </span>
<div style="clear:both"></div>
</h1> 
<!-- start goods form -->
<div class="tab-div">
    <!-- tab bar -->
 
    <!-- tab body -->
    <div id="tabbody-div">
       <table>
	    <tr>
		  <td>收货人：<?php echo $order['user'];?></td>
        </tr>
		 <tr>
		  <td>手机号：<?php echo $order['mobile'];?></td>
        </tr>
		 <tr>
		  <td>产品：<?php echo $order['product_name'];?></td>
        </tr>
	  </table>
	  <form enctype="multipart/form-data" action="" method="post" name="theForm" onSubmit="return yanzheng()">
        <table width="90%" id="general-table" align="center">
          <tr>
            <td class="label">解决状态：</td>
            <td><select name="status" id="status">
			<option value="0">请选择...</option>
			<option value="1">解决中</option>
			<option value="2">已解决</option>
			</select>
            </td>
          </tr>
		   <tr>
            <td class="label">解决方式：</td>
            <td><select name="action_name" id="action_name">
			<option value="0">请选择...</option>
			<option value="1">退款</option>
			<option value="2">补发</option>
			<option value="3">其他</option>
			</select>
            </td>
          </tr>
		 <tr>
            <td class="label">处理人：</td>
            <td><select name="do_name" id="do_name">
			<option value="0">请选择...</option>
			<option value="曾平">曾平</option>
			<option value="郑娟">郑娟</option>
			<option value="张世杰">张世杰</option>
			<option value="唐志伟">唐志伟</option>
			<option value="张文强">张文强</option>
			<option value="林云川">林云川</option>
			</select>
          </tr>
          <tr>
            <td class="label">内容：</td>
            <td><textarea name="content" cols="40" rows="3"></textarea></td>
          </tr>
            <td><input type="hidden" name="order_id" value="<?php echo $_GET['sn'];?>" /></td>
          </tr>
        </table>
 
        <div class="button-div">
          <input type="submit" value=" 确定 " class="button" />
          <input type="reset" value=" 重置 " class="button" />
        </div>
        <input type="hidden" name="act" value="do" />
      </form>
    </div>
</div>
<!-- end goods form -->
</body>
</html>
